//
//  DwtTableViewCell.m
//  生活小助手
//
//  Created by dwt on 14-8-9.
//  Copyright (c) 2014年 lxz. All rights reserved.
//

#import "DwtTableViewCell.h"
#import "DwtFootCategoryList.h"

@interface DwtTableViewCell ()
@property (nonatomic, weak) UILabel *label;
@end

@implementation DwtTableViewCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *identifier = @"friend";
    DwtTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[DwtTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier];
    }
    return cell;
}

// 但凡在init方法中获取到的frame都是0
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) {
        
        // 1.2添加label
        UILabel *label = [[UILabel alloc] init];
        // label.backgroundColor = [UIColor greenColor];
        // 设置文本右对齐
        label.textAlignment = NSTextAlignmentCenter;
        label.textColor = [UIColor blackColor];
        
        [self addSubview:label];
        self.label = label;
    }
    
    //  NSLog(@"initWithReuseIdentifier = %@", NSStringFromCGRect(self.frame));
    return  self;
}



-(void)setFootCategoryList:(DwtFootCategoryList *)footCategoryList{
    _footCategoryList = footCategoryList;
    self.label.text=_footCategoryList.name;

}
-(void)layoutSubviews{
    [super layoutSubviews];
    self.label.frame = CGRectMake(0,0, 320 , 44);

}
@end
